<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class Linkslistskefu extends Model
{
    protected $table = 'links_lists_kefu';
    protected $primaryKey = 'id';

    public static function getLinksListsKefu($links_id)
    {
        return self::select("id","type","text")->where("links_id",$links_id)->orderBy("sort","ASC")->get();
    }

    public static function getCountLinksListsKefu($links_id,$count)
    {
        return self::select("id","type","text")->where("links_id",$links_id)->orderBy("sort","ASC")->take($count)->get()->toArray();
    }

    public static function getNextLinksListsKefu($links_id,$id)
    {
        return self::select("id","type","text")->where("links_id",$links_id)->where("id",">",$id)->first();
    }

    public static function batchInsertLinksListsKefu($services)
    {
        return self::insert($services);
    }

    public static function deleteLinksListsKefu($id)
    {
        return self::where("id",$id)->delete();
    }

    public static function deleteLinksListsAllKefu($links_id)
    {
        return self::where("links_id",$links_id)->delete();
    }
}
